<template>
	<view>
		
	</view>
</template>

<script>
	import {
		GoodsCenterApi
	} from '@/api/serves.js'
	export default {
		data() {
			return {
				goods_id:''
			};
		},
		onLoad(options) {
			console.log('商品id',options.goods_id);
			this.goods_id = options.goods_id
			this._goodsdetail()
		},
		methods:{
			// 获取商品详情
			_goodsdetail() {
				// this.checkedSkuId = ''
				this.attrList = []
				GoodsCenterApi.goodsdetail({
					goods_id: this.goods_id
				}).then(res => {
					console.log('获取商品详情', res);
					if (res.code == 1) {
						let result = res.data
						this.details = result.detail
						this.specInfo.imgshow = this.details.image
						if (result.specData) {
							this.specInfo = result.specData.spec_list[0].form
							let list = result.specData.spec_attr
							// list.map(item=> {
							// 	item.checkedId = ''
							// })
							// console.log('list',list);
							this.attrList = list
							this.skuList = result.specData.spec_list
						} else {
							this.checkedSkuId = this.details.spec[0].spec_sku_id
							console.log('this.checkedSkuId', this.checkedSkuId);
							this.specInfo = this.details.spec[0]
							// this.specInfo.imgshow= this.details.image
						}
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			},
		}
	}
</script>

<style lang="scss">

</style>
